<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Extjs_Nutz_Demo</title>
<!-- 引入dwr资源文件 -->
  	<script type='text/javascript' src='dwr/util.js'></script>
  	<script type='text/javascript' src='dwr/engine.js'></script>
  	<script type='text/javascript' src='dwr/interface/DictUtil.js'></script>
<script type="text/javascript">
	//get string
	function qryDwrStr(){
		DictUtil.getRemoteText("fujian",function(obj) { 
			    alert(obj); 
		 });
	}
	//get dicts
	function qryDictByCode(type){
		DictUtil.qryDictByType(type,function(obj){ 
				if(obj!=null && obj.length>0){
					var selectObj = document.getElementById("dict_id");
					selectObj.options.length=0;
					var op ;
					for(var i=0; i<obj.length; i++){
						op = new Option();
						op.value = obj[i].code;
						op.text = obj[i].value;
						 selectObj.options.add(op);
					}
				}
		 });
	}

</script>
</head>
<body>
<h2>Hello Dwr!</h2>
<input type="button" value="获取字符" onclick="qryDwrStr();">
<input type="button" value="获取民族" onclick='qryDictByCode(1);'>
<input type="button" value="获取地市" onclick='qryDictByCode(2);'>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;选择【获取名族】或者【获取地市】,展示相应的数据。<br/>
数据字典：
<select id="dict_id" style="width: 120px;">
	<option>--请选择--</option>
</select>
</body>
</html>
